//
//  RxTableViewSectionedReloadDataSource.swift
//  BARXSwiftTest
//
//  Created by 孙博岩 on 2018/7/9.
//  Copyright © 2018 boai. All rights reserved.
//

import Foundation
import UIKit
import RxSwift
import RxCocoa

open class RxTableViewSectionedReloadDataSource<S: SectionModelType>
    : TableViewSectionedDataSource<S>
, RxTableViewDataSourceType {
    public typealias Element = [S]
    
    open func tableView(_ tableView: UITableView, observedEvent: Event<Element>) {
        Binder(self) { dataSource, element in
            #if DEBUG
            self._dataSourceBound = true
            #endif
            dataSource.setSections(element)
            tableView.reloadData()
            }.on(observedEvent)
    }
}
